﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using FazaDemo.QL.AbstractQueryModel;
using FazaDemo.ViewModels;
using FazaDemo.Data;

namespace FazaDemo.QueryModel
{
    public class StreetViewRepository : IQueryRepository<object, StreetViewModel>
    {
        public IList<StreetViewModel> Get()
        {
            using (var context = new FazaEntities1())
            {
                var streets = context.Set<TS_STREET>().ToList();
                return streets.Select(s => new StreetViewModel
                {
                    Name = s.NM, 
                    DistrictId = s.DISTRICT_ID, 
                    AltName = s.NM_ALT, 
                    SocialName = s.NM_SOC, 
                    CreatedDate = s.CREATED,
                    UpdatedDate = s.UPDATED,
                    Id = s.ID
                }
                ).ToList();
            }
        }

        public StreetViewModel Get(object context)
        {
            return default(StreetViewModel);
        }
    }
}
